package com.stronger.pettern.Controller;

import com.stronger.pettern.Strategy.MessageContext;
import com.stronger.pettern.Strategy.MessgeStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class TestController {
    @Autowired
    private MessageContext messageContext;
    @GetMapping("/test")
    public String strategyTest(@RequestParam("type") String type){
        MessgeStrategy messgeStrategy=messageContext.getMessageStrategy(null);
        String s = messgeStrategy.sendMessage();
        return s;
    }
}
